/**
 * 
 */
package org.swing.utility.reflection.util;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.swing.utility.reflection.clazz.TypeToClass;

/**
 * @author lqnhu
 *
 */
public class ReflectionUtility {

	public static boolean isInnerClass(Class<?> clazz) {
		return clazz.getEnclosingClass() != null
				&& !Modifier.isStatic(clazz.getModifiers());
	}




	public static boolean isBaseClass(Class<?> clazz) {
		return Object.class.equals(clazz) || clazz.isPrimitive()
				|| clazz.isEnum() || clazz.isArray();
	}


	public static boolean isJavaClass(Class<?> clazz) {
		return isBaseClass(clazz)
				|| clazz.getPackage().getName().startsWith("java.")
				|| clazz.getPackage().getName().startsWith("javax.");
	}


	public static Class<?> getClass(Type type) {
		return TypeToClass.convert(type);
	}
}
